package com.service.device;

import com.common.ErrorCodeEnum;
import com.common.emums.DataStatus;
import com.common.exception.BusinessException;
import com.common.utils.StringUtils;
import com.core.springSecurity.common.SecurityUtils;

import com.dao.secondary.device.DeviceObdBatchRepairRecordMappingInfoMapper;
import com.model.domain.device.GetDeviceObdBatchRepairRecordMappingInfoDO;
import com.model.pojo.device.DeviceObdBatchRepairRecordMappingInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;



/**
 * @Author: zql
 * @Description: OBD设备工厂批量维修记录设备信息服务
 * @Data: 2024-04-09
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DeviceObdBatchRepairRecordMappingInfoService {
    private final DeviceObdBatchRepairRecordMappingInfoMapper deviceObdBatchRepairRecordMappingInfoMapper;

    public DeviceObdBatchRepairRecordMappingInfo getByBatchIdAndSdtu(Long batchId,String sdtu){
        return deviceObdBatchRepairRecordMappingInfoMapper.selectByBatchIdAndSdtu(batchId,sdtu);
    }
    public void saveList(List<DeviceObdBatchRepairRecordMappingInfo> list){
        deviceObdBatchRepairRecordMappingInfoMapper.insertListSelective(list);
    }
    public long countByBatchId(long batchId){
        return deviceObdBatchRepairRecordMappingInfoMapper.countByBatchId(batchId);
    }
    public List<DeviceObdBatchRepairRecordMappingInfo> getAllList(GetDeviceObdBatchRepairRecordMappingInfoDO getDeviceObdBatchRepairRecordMappingInfoDO){
        PageHelper.clearPage();
        PageHelper.orderBy(getDeviceObdBatchRepairRecordMappingInfoDO.getSortRow()+getDeviceObdBatchRepairRecordMappingInfoDO.getSortOrder());
        return deviceObdBatchRepairRecordMappingInfoMapper.selectList(getDeviceObdBatchRepairRecordMappingInfoDO);
    }

    public void updateList(List<DeviceObdBatchRepairRecordMappingInfo> list){
        deviceObdBatchRepairRecordMappingInfoMapper.updateListSelective(list);
    }
}
